<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<table width="500"  border="1px">
		<thead>
			<tr>
			<td>id</td>
			<td>ISB编号</td>
			<td>书名</td>
			<td>作者</td>
			<td>价格</td>
			<td>库存</td>
			<td>类型</td>
			<td>操作</td>
			</tr>
		</thead>
		<tbody id="bookbox">
		<c:if test="${not empty page}">
				<c:forEach items="${page.data}" var="book">
					<tr>
						<td>${book.bookId}</td>
						<td>${book.bookNo}</td>
						<td>${book.bookName}</td>
						<td>${book.bookWriter}</td>
						<td>${book.bookPrice}</td>
						<td>${book.bookNum}</td>
						<td>${book.bookType}</td>
						<td id="${book.bookId}">
   							<span>
       								<a href="delB.do?bookId=${book.bookId}">删除</a>
    							</span>
						</td>
					</tr>
				</c:forEach>
			</c:if>
		</tbody>
	</table>
	<c:if test="${not empty page}">
		<div>
			<c:if test="${page.hasPrev}">
				<a href="Book.do?pageNum=${page.pageNum - 1}&pageSize=${page.pageSize}">上一页</a>
			</c:if>
			
			<c:forEach begin="1" end="${page.totalPage}" var="p">
            <c:choose>
                <c:when test="${p == page.pageNum}">
                    <span>${p}</span>
                </c:when>
                <c:otherwise>
                    <a href="Book.do?pageNum=${p}&pageSize=${page.pageSize}">${p}</a>
                </c:otherwise>
            </c:choose>
        </c:forEach>
			<c:if test="${page.hasNext}">
				<a href="Book.do?pageNum=${page.pageNum + 1}&pageSize=${page.pageSize}">下一页</a>
			</c:if>
		</div>
	</c:if>
</body>
</html>